﻿using System;
using Abp.Domain.Entities.Auditing;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using FwProject.Authorization.Users;
using FwProject.Core.Car;
using System.Collections;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace FwProject.Core.Restaurant
{
    /// <summary>
    /// 装车情况
    /// </summary>
    [Table("LoadCar")]
    public class LoadCar : FullAuditedEntity<Guid>
    {
        public const int StringLength = 200;

        /// <summary>
        /// 所属工厂
        /// </summary>

        [Display(Name = "所属工厂")]
        public Guid? FactoryinfoId { get; set; }

        /// <summary>
        /// 装车id
        /// </summary>
        /// <value>The employee restaurant identifier.</value>
        public Guid? CarInfoId { get; set; }
        /// <summary>
        /// 汽车信息
        /// </summary>
        /// <value>The user info DAO.</value>
        [ForeignKey("CarInfoId")]
        public virtual CarInfo CarInfoModel { get; set; }

        public string CreationNumber { get; set; }

        /// <summary>
        /// 出库库管编号
        /// </summary>
        public long? OutUserId { get; set; }
        /// <summary>
        /// 回库库管编号
        /// </summary>
        public long? BackUserId { get; set; }

        [Required]
        public CarStatus CarStatus { get; set; } = CarStatus.已装车;

        public ExamineStatus ExamineStatus { get; set; } = ExamineStatus.未审核;

        public BackStatus BackStatus { get; set; } = BackStatus.未审核;

        public virtual  ICollection<LoadingCarInfo> LoadingCarInfoList { get; set; }

        public DateTime? OverTime { get; set; }

        /// <summary>
        /// 司机配送回库时间
        /// </summary>
        public DateTime? BackStatusOverTime { get; set; }

        public long? DriverUserId { get; set; }
    }
    /// <summary>
    /// 装车状态
    /// </summary>
    public enum CarStatus
    {
        [Display(Name ="已装车")]
        已装车=0,
        [Display(Name = "出库审核中")]
        出库审核中 =1,
        [Display(Name = "配送中")]
        配送中 = 2,
        [Display(Name = "回库审核中")]
        回库审核中 =3,
        [Display(Name = "配送完成")]
        配送完成 =4
    }
    /// <summary>
    /// 出库审核状态
    /// </summary>
    public enum ExamineStatus
    {
        [Display(Name = "未审核")]
        未审核 = 0,
        [Display(Name = "已审核")]
        已审核 =1 
    }
    /// <summary>
    /// 回库审核状态
    /// </summary>
    public enum BackStatus
    {
        [Display(Name = "未审核")]
        未审核 = 0,
        [Display(Name = "已审核")]
        已审核 = 1
    }
}
